package pt.compflow.client.ui;

import java.util.HashMap;
import java.util.Map;

import org.restlet.data.Status;
import org.restlet.representation.EmptyRepresentation;
import org.restlet.representation.Representation;
import org.restlet.resource.Get;

public class TemplateUIResource extends UIBaseResource {

	private static final Map<String, String> templateMap = new HashMap<String, String>();
	
	static {
		templateMap.put("login", "LoginTemplate.ftl");
	}
		
	@Get
	public Representation get() {
		
		if(!getRequestAttributes().containsKey("template") || getRequestAttributes().get("template") == null || !templateMap.containsKey(getRequestAttributes().get("template"))) {
			setStatus(Status.CLIENT_ERROR_NOT_FOUND);
			return new EmptyRepresentation();
		}
		
		return getTemplateRepresentation(templateMap.get(getRequestAttributes().get("template")), null);
	}
	
}
